package cn.db101.api.complex.controller

import cn.db101.api.complex.model.WebResult
import cn.db101.api.complex.service.OcrService
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.bind.annotation.RestController
import org.springframework.web.multipart.MultipartFile

/**
 * @author zooy
 * @since 2024/11/19-16:56
 */
@RestController
@RequestMapping("api/image/v1")
open class ImageController {

    @Autowired
    private lateinit var ocrService: OcrService

    @RequestMapping("ocr")
    open fun ocr(@RequestParam("file") multipartFile: MultipartFile): WebResult<Any> {

        return WebResult.wrapSuccessResult(ocrService.doOcr(multipartFile))
    }
}
